using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;

namespace InfraStructureLayer
{
    public class CurrentContext
    {

        public static DataTable Pages
        {
            get { return (DataTable)System.Web.HttpContext.Current.Application["Pages"]; }
            set { System.Web.HttpContext.Current.Application["Pages"] = value; }
        }
        public static DataTable Menu
        {
            get { return (DataTable)System.Web.HttpContext.Current.Application["Menu"]; }
            set { System.Web.HttpContext.Current.Application["Menu"] = value; }
        }
        public static Hashtable Multilanguage
        {
            get { return (Hashtable)System.Web.HttpContext.Current.Application["Multilanguage"]; }
            set { System.Web.HttpContext.Current.Application["Multilanguage"] = value; }
        }
        public static Hashtable ErrorMessagesMultilanguage
        {
            get { return (Hashtable)System.Web.HttpContext.Current.Application["ErrorMessagesMultilanguage"]; }
            set { System.Web.HttpContext.Current.Application["ErrorMessagesMultilanguage"] = value; }
        }
        public static int? LanguageId
        {
            get { if (System.Web.HttpContext.Current.Session["LanguageId"] == null) { return null; } else { return Convert.ToInt32(System.Web.HttpContext.Current.Session["LanguageId"]); }; }
            set { System.Web.HttpContext.Current.Session["LanguageId"] = value; }
        }
        public static string Language
        {
            get { return Languages.Select("LanguageId=" + LanguageId.ToString())[0]["LanguageCulture"].ToString().Substring(0, 2); }
        }
        public static DataTable Languages
        {
            get { return (DataTable)System.Web.HttpContext.Current.Application["Languages"]; }
            set { System.Web.HttpContext.Current.Application["Languages"] = value; }
        }
        public static int? UserId
        {
            get { if (System.Web.HttpContext.Current.Session["UserId"] == null) { return null; } else { return Convert.ToInt32(System.Web.HttpContext.Current.Session["UserId"]); }; }
            set { System.Web.HttpContext.Current.Session["UserId"] = value; }
        }
        public static Hashtable Parameters
        {
            get { return (Hashtable)System.Web.HttpContext.Current.Application["Parameters"]; }
            set { System.Web.HttpContext.Current.Application["Parameters"] = value; }
        }
        public static Dictionary<string,string> Querystrings
        {
            get { return (Dictionary<string, string>)System.Web.HttpContext.Current.Application["Querystrings"]; }
            set { System.Web.HttpContext.Current.Application["Querystrings"] = value; }
        }
        
    }
    public class Session
    {
        public object this[int i]
        {
            get { return System.Web.HttpContext.Current.Session[i]; }
            set { System.Web.HttpContext.Current.Session[i] = value; }
        }
        public object this[string name]
        {
            get { return System.Web.HttpContext.Current.Session[name]; }
            set { System.Web.HttpContext.Current.Session[name] = value; }
        }
    }
    public class Application
    {
        public object this[int i]
        {
            get { return System.Web.HttpContext.Current.Application[i]; }
        }
        public object this[string name]
        {
            get { return System.Web.HttpContext.Current.Application[name]; }
            set { System.Web.HttpContext.Current.Application[name] = value; }
        }
    }
}
